<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css" />
    <link rel="stylesheet" type="text/css" href="../../lib/Validform/5.3.2/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../ht-css/style-q.css" />
    <title>商品设置</title>
</head>
<body data-id="">
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页  <span class="c-gray en">&gt;</span>方盛云仓<span class="c-gray en">&gt;</span>云仓管理<span class="c-gray en">&gt;</span>商品设置<span class="c-gray en">&gt;</span>添加商品<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
    <form class="ml-20 mr-20" id="form-member-add" method="post">

        <div class="bg-1 bk-gray pd-20 mb-20">
            <div class="pd-20 mb-20">
                <table>
                    <input type="button" onclick="upLoadFile()"  class="btn btn-secondary radius size-S "  style="margin-left: 51px;" value="导入商品">
                    <input id="fileUp" type="file" onchange="putDataToPage()" style="display: none">
                    <a  class="btn btn-secondary radius size-S " style="margin-left: 51px;" id="upLoadFileall" onclick="upLoadFileall()" href="">下载模板</a>
                </table>
            </div>
            <input type="button" onclick="cancelBtn()"  class="btn btn-secondary radius size-S " style="margin-left: 321px;" value="返回">
        </div>

    </form>
</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/Validform/5.3.2/Validform_v5.3.2_min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../ht-js/Project.js?rev=@@hash"></script>
<script src="../../ht-js/dynamicWarehouse.js?rev=@@hash"></script>
<!--权限控制-->
<script type="text/javascript" src="../../ht-js/power.js?rev=@@hash"></script>
<script>
    function cancelBtn() {
        /*parent.layer.closeAll();*/
        window.parent.goods();
        window.parent.shezhi();
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }


    function upLoadFile() {
        $("#fileUp").trigger('click');
    }
    function putDataToPage() {
        var formData = new FormData();
        formData.append('file', $("#fileUp")[0].files[0]);
        formData.append('houseId', sessionStorage.getItem("houstIdss"));
        $.ajax({
            url: 'https://'+ window.location.host +'/api/admin/anobodyhouse/insertHouseProduct',
            cache: false,  //禁用缓存
            type: "POST",
            // 告诉jQuery不要去处理发送的数据
            processData: false,
            // 告诉jQuery不要去设置Content-Type请求头
            contentType: false,
            data: formData,
            success: function (data) {
                $('#fileUp').val('');
                if(data.errorCode==1){
                    var curInd = layer.confirm('<span id="status" style="width:200px;height:100px;resize: none;" maxlength="200" >格式有误，请重新上传</span>', {title:'上传失败',btn: ['重新上传', '取消']}, function(index){
                        layer.close(curInd);
                    },function(){
                        layer.close(curInd);

                    });


                }else if(data.errorCode==5) {
                    var curInd = layer.confirm('<span id="status" style="width:200px;height:100px;resize: none;" maxlength="200" >'+data.msg+'导致上传失败，请重新上传</span>', {title:'上传失败',btn: ['重新上传', '取消']}, function(index){
                        layer.close(curInd);
                    },function(){
                        layer.close(curInd);


                    });

                }else if(data.errorCode==0){
                    var curInd = layer.confirm('<span id="status" style="width:200px;height:100px;resize: none;" maxlength="200" >确定后返回上一页查看商品明细</span>', {title:'上传成功',btn: ['确定']}, function(index){
                        layer.close(curInd);
                        window.parent.quyuaqq();
                        window.parent.shezhi();
                        parent.layer.closeAll();

                    },function(){
                        layer.close(curInd);
                        window.parent.quyuaqq();
                        window.parent.shezhi();
                        parent.layer.closeAll();


                    });
                }



            }
        });

    }

    function upLoadFileall() {
        $("#upLoadFileall").attr("href",'https://'+ window.location.host +'/api/admin/abaseservice/downLoadFromUrl?urlStr=https://fsyuncai-file.oss-cn-beijing.aliyuncs.com/common/20190828172354785566.xlsx&fileName=%E4%BA%91%E4%BB%93%E5%95%86%E5%93%81%E5%AF%BC%E5%85%A5excel%E6%A8%A1%E6%9D%BF')

    }
</script>
</body>
</html>